﻿using System.Collections.Generic;
using System.ComponentModel;
using Newtonsoft.Json;

namespace Hourglass.Qrobot.Models
{
    /// <summary>
    /// 请求返回的好友列表Model
    /// </summary>
    public sealed class ReturnedUserFriends
    {
        [JsonProperty("friends")]
        public List<Friend> Friends { get; set; }

        [JsonProperty("marknames")]
        public List<MarkName> MarkNames { get; set; }

        [JsonProperty("categories")]
        public List<Category> Categories { get; set; }

        [JsonProperty("vipinfo")]
        public List<VipInfo> VipInfos { get; set; }

        [JsonProperty("info")]
        public List<Info> Infos { get; set; }

        public static ReturnedUserFriends EmptyNew()
        {
            return new ReturnedUserFriends
            {
                Friends = new List<Friend>(),
                MarkNames = new List<MarkName>(),
                Categories = new List<Category>(),
                VipInfos = new List<VipInfo>(),
                Infos = new List<Info>()
            };
        }

        #region Internal Class
        public sealed class Friend
        {
            [JsonProperty("uin")]
            public long Uin { get; set; }

            [JsonProperty("flag")]
            public long Flag { get; set; }

            [JsonProperty("categories")]
            public int CategoryId { get; set; }
        }

        public sealed class MarkName
        {
            [JsonProperty("uin")]
            public long Uin { get; set; }

            [JsonProperty("markname")]
            public string Name { get; set; }

            [JsonProperty("type")]
            public int Type { get; set; }
        }

        public sealed class Category
        {
            [JsonProperty("index")]
            public int Index { get; set; }

            [JsonProperty("sort")]
            public int Sort { get; set; }

            [JsonProperty("name")]
            public string Name { get; set; }
        }

        public class VipInfo
        {
            [DefaultValue(0)]
            [JsonProperty("vip_level")]
            public int Level { get; set; }

            [JsonProperty("u")]
            public long Uin { get; set; }

            [JsonProperty("is_vip")]
            public int IsVip { get; set; }
        }

        public sealed class Info
        {
            /// <summary>
            /// QQ Id
            /// </summary>
            [JsonProperty("uin")]
            public long Uin { get; set; }

            [JsonProperty("face")]
            public int Face { get; set; }

            [JsonProperty("flag")]
            public long Flag { get; set; }

            /// <summary>
            /// 昵称
            /// </summary>
            [JsonProperty("nick")]
            public string NickName { get; set; }
        }

        #endregion Internal Class
    }
}
